<?php
  /**
   * iJPlugins
   *
   * The iJPlugins class 
   *
   * @copyright Copyright (c) 2011, iJBloks Progect
   */
    class iJPlugins {
        
        /**
         *
         * Class Constructuctor
         * @access public
         */
        public function __construct() {
    
        }
        
        public function getPluginsList($page, $search, $limit = '') {
          $iJDataBase  =  iJFactory::singleton('iJDataBase');
          $QPlugin    =  $iJDataBase->query('SELECT 
                                              Title, 
                                              Path,
                                              Version,
                                              Site
                                            FROM :table_plugins
                                            ');
          $QPlugin->bindTable(':table_plugins', TABLE_PLUGINS);
          
          if(!empty($search)) {
            $QPlugin->appendQuery('WHERE Title like :search');
            $QPlugin->bindValue(':search', '%' . $search . '%');
          }
          
          $QPlugin->appendQuery(':limit');
          $QPlugin->bindTable(':limit', $QPlugin->addLimit($page, $limit));
          $QPlugin->execute();
          
          $plugins = array();
          
          while($QPlugin->next()) {
            $plug['title']   = $QPlugin->value('Title');
            $plug['path']    = $QPlugin->value('Path');
            $plug['site']    = $QPlugin->value('Version');
            $plug['version'] = $QPlugin->value('Site');
            //$plug['trash'] = iJHrefLink::linkToLocalPage('admin_config') . '?delKey=' . $QPlugin->value('configKey');
            $plugins[] = $plug;
            
          }
          
            /*
  $code['js'][0] = 'top_up-min.js';
  $code['js'][1] = 'top_up-min.jaaas';
  
  $code['css'][0] = 'top_up-min.css';
  $code['css'][1] = 'top_up-min.css';
  $code['css'][2] = 'top_up-min.css';
  
  $code['other'] = '<script type="text/javascript">
      TopUp.images_path = "{$EXTERNAL_JS_RELATIVE}top_up/images/";
    </script> ';

  $sCode = htmlspecialchars(mysql_escape_string(serialize($code)));
  spr($sCode);
  die();*/
          return array($plugins, $QPlugin);
          
        }
      }
?>